<html>
<head>
	<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
	<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">
	<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/js/bootstrap.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function() {
    $("a.toggle").toggle(function(){
        $(this).text($(this).text().replace(/隐藏/,'显示'));
        var a=$(this).parents(".summary");
        a.find(".inherited").hide();
    },function(){
        $(this).text($(this).text().replace(/显示/,'隐藏'));
        $(this).parents(".summary").find(".inherited").show();
    });
});
</script>


   <!-- 左侧栏 -->
	<div class="container">
	<div class="row">
    <div id="subpage_sidebar" class="left apidoc-classes-index span3">

      

<h3>包 core</h3>

<ul>
    <li>
    <a href="./class-q.html" title="Q">Q</a>
  </li>
    <li>
    <a href="./class-qexception.html" title="QException">QException</a>
  </li>
    <li>
    <a href="./class-qcoll.html" title="QColl">QColl</a>
  </li>
    <li>
    <a href="./class-qcontext.html" title="QContext">QContext</a>
  </li>
    <li>
    <a href="./class-qlog.html" title="QLog">QLog</a>
  </li>
  
</ul>


<h3>包 mvc</h3>

<ul>
    <li>
    <a href="./class-qacl.html" title="QACL">QACL</a>
  </li>
    <li>
    <a href="./class-qcontroller-abstract.html" title="QController_Abstract">QController_Abstract</a>
  </li>
    <li>
    <a href="./class-qcontroller-forward.html" title="QController_Forward">QController_Forward</a>
  </li>
    <li>
    <a href="./class-qrouter.html" title="QRouter">QRouter</a>
  </li>
    <li>
    <a href="./class-qview-output.html" title="QView_Output">QView_Output</a>
  </li>
    <li>
    <a href="./class-qview-redirect.html" title="QView_Redirect">QView_Redirect</a>
  </li>
    <li>
    <a href="./class-qview-render-php.html" title="QView_Render_PHP">QView_Render_PHP</a>
  </li>
    <li>
    <a href="./class-qview-render-php-parser.html" title="QView_Render_PHP_Parser">QView_Render_PHP_Parser</a>
  </li>
  
</ul>


<h3>包 orm</h3>

<ul>
    <li>
    <a href="./class-qdb-activerecord-behavior-abstract.html" title="QDB_ActiveRecord_Behavior_Abstract">QDB_ActiveRecord_Behavior_Abst...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-abstract.html" title="QDB_ActiveRecord_Abstract">QDB_ActiveRecord_Abstract</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-association-abstract.html" title="QDB_ActiveRecord_Association_Abstract">QDB_ActiveRecord_Association_A...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-association-belongsto.html" title="QDB_ActiveRecord_Association_BelongsTo">QDB_ActiveRecord_Association_B...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-association-coll.html" title="QDB_ActiveRecord_Association_Coll">QDB_ActiveRecord_Association_C...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-association-hasmany.html" title="QDB_ActiveRecord_Association_HasMany">QDB_ActiveRecord_Association_H...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-association-hasone.html" title="QDB_ActiveRecord_Association_HasOne">QDB_ActiveRecord_Association_H...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-association-manytomany.html" title="QDB_ActiveRecord_Association_ManyToMany">QDB_ActiveRecord_Association_M...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-meta.html" title="QDB_ActiveRecord_Meta">QDB_ActiveRecord_Meta</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-view.html" title="QDB_ActiveRecord_View">QDB_ActiveRecord_View</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-viewmeta.html" title="QDB_ActiveRecord_ViewMeta">QDB_ActiveRecord_ViewMeta</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-callbacks.html" title="QDB_ActiveRecord_Callbacks">QDB_ActiveRecord_Callbacks</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-interface.html" title="QDB_ActiveRecord_Interface">QDB_ActiveRecord_Interface</a>
  </li>
  
</ul>


<h3>包 form</h3>

<ul>
    <li>
    <a href="./class-qform-element.html" title="QForm_Element">QForm_Element</a>
  </li>
    <li>
    <a href="./class-qform-group.html" title="QForm_Group">QForm_Group</a>
  </li>
    <li>
    <a href="./class-qform.html" title="QForm">QForm</a>
  </li>
  
</ul>


<h3>包 database</h3>

<ul>
    <li>
    <a href="./class-qdb-adapter-abstract.html" title="QDB_Adapter_Abstract">QDB_Adapter_Abstract</a>
  </li>
    <li>
    <a href="./class-qdb-adapter-mysql.html" title="QDB_Adapter_Mysql">QDB_Adapter_Mysql</a>
  </li>
    <li>
    <a href="./class-qdb-adapter-pdo-abstract.html" title="QDB_Adapter_Pdo_Abstract">QDB_Adapter_Pdo_Abstract</a>
  </li>
    <li>
    <a href="./class-qdb-adapter-pdo-exception.html" title="QDB_Adapter_Pdo_Exception">QDB_Adapter_Pdo_Exception</a>
  </li>
    <li>
    <a href="./class-qdb-adapter-pdo-pgsql.html" title="QDB_Adapter_Pdo_Pgsql">QDB_Adapter_Pdo_Pgsql</a>
  </li>
    <li>
    <a href="./class-qdb-adapter-pgsql.html" title="QDB_Adapter_Pgsql">QDB_Adapter_Pgsql</a>
  </li>
    <li>
    <a href="./class-qdb-cond.html" title="QDB_Cond">QDB_Cond</a>
  </li>
    <li>
    <a href="./class-qdb.html" title="QDB">QDB</a>
  </li>
    <li>
    <a href="./class-qdb-expr.html" title="QDB_Expr">QDB_Expr</a>
  </li>
    <li>
    <a href="./class-qdb-result-abstract.html" title="QDB_Result_Abstract">QDB_Result_Abstract</a>
  </li>
    <li>
    <a href="./class-qdb-result-mysql.html" title="QDB_Result_Mysql">QDB_Result_Mysql</a>
  </li>
    <li>
    <a href="./class-qdb-result-pdo.html" title="QDB_Result_Pdo">QDB_Result_Pdo</a>
  </li>
    <li>
    <a href="./class-qdb-result-pgsql.html" title="QDB_Result_Pgsql">QDB_Result_Pgsql</a>
  </li>
    <li>
    <a href="./class-qdb-select.html" title="QDB_Select">QDB_Select</a>
  </li>
    <li>
    <a href="./class-qdb-table.html" title="QDB_Table">QDB_Table</a>
  </li>
    <li>
    <a href="./class-qdb-table-lite.html" title="QDB_Table_Lite">QDB_Table_Lite</a>
  </li>
  
</ul>


<h3>包 helper</h3>

<ul>
    <li>
    <a href="./class-helper-filesys.html" title="Helper_Filesys">Helper_Filesys</a>
  </li>
    <li>
    <a href="./class-helper-array.html" title="Helper_Array">Helper_Array</a>
  </li>
    <li>
    <a href="./class-qdom-document.html" title="QDom_Document">QDom_Document</a>
  </li>
    <li>
    <a href="./class-qdom-element.html" title="QDom_Element">QDom_Element</a>
  </li>
    <li>
    <a href="./class-qfilter.html" title="QFilter">QFilter</a>
  </li>
    <li>
    <a href="./class-helper-image.html" title="Helper_Image">Helper_Image</a>
  </li>
    <li>
    <a href="./class-helper-imagegd.html" title="Helper_ImageGD">Helper_ImageGD</a>
  </li>
    <li>
    <a href="./class-helper-imgcode.html" title="Helper_ImgCode">Helper_ImgCode</a>
  </li>
    <li>
    <a href="./class-helper-imgcodesimple.html" title="Helper_ImgCodeSimple">Helper_ImgCodeSimple</a>
  </li>
    <li>
    <a href="./class-helper-imgcodettf.html" title="Helper_ImgCodeTTF">Helper_ImgCodeTTF</a>
  </li>
    <li>
    <a href="./class-helper-uploader.html" title="Helper_Uploader">Helper_Uploader</a>
  </li>
    <li>
    <a href="./class-helper-uploader-file.html" title="Helper_Uploader_File">Helper_Uploader_File</a>
  </li>
    <li>
    <a href="./class-qvalidator.html" title="QValidator">QValidator</a>
  </li>
    <li>
    <a href="./class-helper-yaml.html" title="Helper_YAML">Helper_YAML</a>
  </li>
  
</ul>


<h3>包 cache</h3>

<ul>
    <li>
    <a href="./class-qcache-apc.html" title="QCache_APC">QCache_APC</a>
  </li>
    <li>
    <a href="./class-qcache-file.html" title="QCache_File">QCache_File</a>
  </li>
    <li>
    <a href="./class-qcache-memcached.html" title="QCache_Memcached">QCache_Memcached</a>
  </li>
    <li>
    <a href="./class-qcache-memory.html" title="QCache_Memory">QCache_Memory</a>
  </li>
    <li>
    <a href="./class-qcache-phpdatafile.html" title="QCache_PHPDataFile">QCache_PHPDataFile</a>
  </li>
    <li>
    <a href="./class-qcache-xcache.html" title="QCache_XCache">QCache_XCache</a>
  </li>
  
</ul>


<h3>包 webcontrols</h3>

<ul>
    <li>
    <a href="./class-qui-control-abstract.html" title="QUI_Control_Abstract">QUI_Control_Abstract</a>
  </li>
    <li>
    <a href="./class-control-input-abstract.html" title="Control_Input_Abstract">Control_Input_Abstract</a>
  </li>
    <li>
    <a href="./class-control-button.html" title="Control_Button">Control_Button</a>
  </li>
    <li>
    <a href="./class-control-checkbox-abstract.html" title="Control_Checkbox_Abstract">Control_Checkbox_Abstract</a>
  </li>
    <li>
    <a href="./class-control-checkbox.html" title="Control_Checkbox">Control_Checkbox</a>
  </li>
    <li>
    <a href="./class-control-checkboxgroup-abstract.html" title="Control_CheckboxGroup_Abstract">Control_CheckboxGroup_Abstract</a>
  </li>
    <li>
    <a href="./class-control-checkboxgroup.html" title="Control_CheckboxGroup">Control_CheckboxGroup</a>
  </li>
    <li>
    <a href="./class-control-dropdownlist.html" title="Control_DropdownList">Control_DropdownList</a>
  </li>
    <li>
    <a href="./class-control-hidden.html" title="Control_Hidden">Control_Hidden</a>
  </li>
    <li>
    <a href="./class-control-label.html" title="Control_Label">Control_Label</a>
  </li>
    <li>
    <a href="./class-control-listbox.html" title="Control_Listbox">Control_Listbox</a>
  </li>
    <li>
    <a href="./class-control-memo.html" title="Control_Memo">Control_Memo</a>
  </li>
    <li>
    <a href="./class-control-password.html" title="Control_Password">Control_Password</a>
  </li>
    <li>
    <a href="./class-control-radio.html" title="Control_Radio">Control_Radio</a>
  </li>
    <li>
    <a href="./class-control-radiogroup.html" title="Control_RadioGroup">Control_RadioGroup</a>
  </li>
    <li>
    <a href="./class-control-reset.html" title="Control_Reset">Control_Reset</a>
  </li>
    <li>
    <a href="./class-control-static.html" title="Control_Static">Control_Static</a>
  </li>
    <li>
    <a href="./class-control-submit.html" title="Control_Submit">Control_Submit</a>
  </li>
    <li>
    <a href="./class-control-textbox.html" title="Control_Textbox">Control_Textbox</a>
  </li>
    <li>
    <a href="./class-control-upload.html" title="Control_Upload">Control_Upload</a>
  </li>
  
</ul>


<h3>包 behavior</h3>

<ul>
    <li>
    <a href="./class-model-behavior-acluser.html" title="Model_Behavior_AclUser">Model_Behavior_AclUser</a>
  </li>
    <li>
    <a href="./class-model-behavior-fastuuid.html" title="Model_Behavior_Fastuuid">Model_Behavior_Fastuuid</a>
  </li>
    <li>
    <a href="./class-model-behavior-relation.html" title="Model_Behavior_Relation">Model_Behavior_Relation</a>
  </li>
    <li>
    <a href="./class-model-behavior-uniqueness.html" title="Model_Behavior_Uniqueness">Model_Behavior_Uniqueness</a>
  </li>
  
</ul>


<h3>包 exception</h3>

<ul>
    <li>
    <a href="./class-qcache-exception.html" title="QCache_Exception">QCache_Exception</a>
  </li>
    <li>
    <a href="./class-q-classfileexistsexception.html" title="Q_ClassFileExistsException">Q_ClassFileExistsException</a>
  </li>
    <li>
    <a href="./class-q-classnotdefinedexception.html" title="Q_ClassNotDefinedException">Q_ClassNotDefinedException</a>
  </li>
    <li>
    <a href="./class-q-createdirfailedexception.html" title="Q_CreateDirFailedException">Q_CreateDirFailedException</a>
  </li>
    <li>
    <a href="./class-q-createfilefailedexception.html" title="Q_CreateFileFailedException">Q_CreateFileFailedException</a>
  </li>
    <li>
    <a href="./class-q-filenotfoundexception.html" title="Q_FileNotFoundException">Q_FileNotFoundException</a>
  </li>
    <li>
    <a href="./class-q-filenotreadableexception.html" title="Q_FileNotReadableException">Q_FileNotReadableException</a>
  </li>
    <li>
    <a href="./class-q-illegalclassnameexception.html" title="Q_IllegalClassNameException">Q_IllegalClassNameException</a>
  </li>
    <li>
    <a href="./class-q-illegalfilenameexception.html" title="Q_IllegalFilenameException">Q_IllegalFilenameException</a>
  </li>
    <li>
    <a href="./class-qlog-exception.html" title="QLog_Exception">QLog_Exception</a>
  </li>
    <li>
    <a href="./class-q-notimplementedexception.html" title="Q_NotImplementedException">Q_NotImplementedException</a>
  </li>
    <li>
    <a href="./class-q-removedirfailedexception.html" title="Q_RemoveDirFailedException">Q_RemoveDirFailedException</a>
  </li>
    <li>
    <a href="./class-qdb-exception.html" title="QDB_Exception">QDB_Exception</a>
  </li>
    <li>
    <a href="./class-qdb-exception-duplicatekey.html" title="QDB_Exception_DuplicateKey">QDB_Exception_DuplicateKey</a>
  </li>
    <li>
    <a href="./class-qdb-select-exception.html" title="QDB_Select_Exception">QDB_Select_Exception</a>
  </li>
    <li>
    <a href="./class-qdb-table-exception.html" title="QDB_Table_Exception">QDB_Table_Exception</a>
  </li>
    <li>
    <a href="./class-acluser-exception.html" title="AclUser_Exception">AclUser_Exception</a>
  </li>
    <li>
    <a href="./class-acluser-duplicateusernameexception.html" title="AclUser_DuplicateUsernameException">AclUser_DuplicateUsernameExcep...</a>
  </li>
    <li>
    <a href="./class-acluser-usernamenotfoundexception.html" title="AclUser_UsernameNotFoundException">AclUser_UsernameNotFoundExcept...</a>
  </li>
    <li>
    <a href="./class-acluser-wrongpasswordexception.html" title="AclUser_WrongPasswordException">AclUser_WrongPasswordException</a>
  </li>
    <li>
    <a href="./class-qform-exception.html" title="QForm_Exception">QForm_Exception</a>
  </li>
    <li>
    <a href="./class-qdom-exception.html" title="QDom_Exception">QDom_Exception</a>
  </li>
    <li>
    <a href="./class-qvalidator-exception.html" title="QValidator_Exception">QValidator_Exception</a>
  </li>
    <li>
    <a href="./class-qvalidator-validatefailedexception.html" title="QValidator_ValidateFailedException">QValidator_ValidateFailedExcep...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-association-exception.html" title="QDB_ActiveRecord_Association_Exception">QDB_ActiveRecord_Association_E...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-association-notdefinedexception.html" title="QDB_ActiveRecord_Association_NotDefinedException">QDB_ActiveRecord_Association_N...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-association-rejectexception.html" title="QDB_ActiveRecord_Association_RejectException">QDB_ActiveRecord_Association_R...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-behavior-exception.html" title="QDB_ActiveRecord_Behavior_Exception">QDB_ActiveRecord_Behavior_Exce...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-exception.html" title="QDB_ActiveRecord_Exception">QDB_ActiveRecord_Exception</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-calltoundefinedmethodexception.html" title="QDB_ActiveRecord_CallToUndefinedMethodException">QDB_ActiveRecord_CallToUndefin...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-changingreadonlypropexception.html" title="QDB_ActiveRecord_ChangingReadonlyPropException">QDB_ActiveRecord_ChangingReado...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-compositepkincompatibleexception.html" title="QDB_ActiveRecord_CompositePKIncompatibleException">QDB_ActiveRecord_CompositePKIn...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-destroywithoutidexception.html" title="QDB_ActiveRecord_DestroyWithoutIdException">QDB_ActiveRecord_DestroyWithou...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-expectsassocpropexception.html" title="QDB_ActiveRecord_ExpectsAssocPropException">QDB_ActiveRecord_ExpectsAssocP...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-meta-exception.html" title="QDB_ActiveRecord_Meta_Exception">QDB_ActiveRecord_Meta_Exceptio...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-settingproptypemismatchexception.html" title="QDB_ActiveRecord_SettingPropTypeMismatchException">QDB_ActiveRecord_SettingPropTy...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-undefinedpropexception.html" title="QDB_ActiveRecord_UndefinedPropException">QDB_ActiveRecord_UndefinedProp...</a>
  </li>
    <li>
    <a href="./class-qdb-activerecord-validatefailedexception.html" title="QDB_ActiveRecord_ValidateFailedException">QDB_ActiveRecord_ValidateFaile...</a>
  </li>
    <li>
    <a href="./class-qacl-exception.html" title="QACL_Exception">QACL_Exception</a>
  </li>
    <li>
    <a href="./class-qrouter-exception.html" title="QRouter_Exception">QRouter_Exception</a>
  </li>
    <li>
    <a href="./class-qrouter-invalidrouteexception.html" title="QRouter_InvalidRouteException">QRouter_InvalidRouteException</a>
  </li>
    <li>
    <a href="./class-qrouter-routenotfoundexception.html" title="QRouter_RouteNotFoundException">QRouter_RouteNotFoundException</a>
  </li>
    <li>
    <a href="./class-qview-exception.html" title="QView_Exception">QView_Exception</a>
  </li>
    <li>
    <a href="./class-qui-exception.html" title="QUI_Exception">QUI_Exception</a>
  </li>
  
</ul>


<h3>包 debug</h3>

<ul>
    <li>
    <a href="./class-qdebug.html" title="QDebug">QDebug</a>
  </li>
    <li>
    <a href="./class-qdebug-firephp.html" title="QDebug_FirePHP">QDebug_FirePHP</a>
  </li>
  
</ul>



    </div>

    <!-- /左侧栏 -->

    <!-- 右侧栏 -->

    <div id="col3" class="right contents span9">

      
<div class="apidoc-class">

  <h1>类 - QContext</h1>

  <ul class="nav nav-tabs">
    <li class="active"><a href="./index.html">所有包</a></li>

        <li><a href="#properties">类属性</a></li>
    
        <li><a href="#methods">类方法</a></li>
    

  </ul>

  
<table class="summary-table table table-bordered" cellpadding="0" cellspacing="0" >
  <tr>
    <th nowrap="nowrap">包</th>
    <td>core</td>
  </tr>
  <tr>
    <th nowrap="nowrap">类层次</th>
    <td>
    class QContext
    </td>
  </tr>

    <tr>
    <th nowrap="nowrap">实现的接口</th>
    <td></td>
  </tr>
  
  
    <tr>
    <th nowrap="nowrap">版本</th>
    <td>$Id: context.php 2647 2009-08-14 01:42:29Z jerry $</td>
  </tr>
  
</table>

<div class="formatted">
  
<p>QContext 封装了运行时上下文</p>

<p>所谓运行时上下文是指 QeePHP 应用程序的运行环境本身。
QContext 主要封装了请求参数和请求状态，以及 URL
解析等功能。</p>

<p>QContext 使用了单子设计模式，因此只能使用
QContext::instance() 来获得 QContext 对象的唯一实例。</p>

<p>QContext 实现了 ArrayAccess 接口，可以将 QContext
对象当作数组一样使用。</p>

<pre class="php code"><span class="kw1">if</span> <span
class="br0">&#40;</span><span class="kw3">isset</span><span
class="br0">&#40;</span><span class="re0">$context</span><span
class="br0">&#91;</span><span class="st_h">'title'</span><span
class="br0">&#93;</span><span class="br0">&#41;</span><span
class="br0">&#41;</span>
<span class="br0">&#123;</span>
    <span
class="kw3">echo</span> <span class="re0">$context</span><span
class="br0">&#91;</span><span class="st_h">'title'</span><span
class="br0">&#93;</span><span class="sy0">;</span>
<span
class="br0">&#125;</span></pre>
</div>


  <a name="properties"></a>

  
<div class="summary">

  <h2>公开的属性</h2>
  <p>
    <a href="#" class="toggle">隐藏继承的属性</a>
  </p>

  <table class="list-table table table-bordered">
    <tr>
      <th>属性</th><th>类型</th><th>描述</th><th>定义于</th>
    </tr>

    
    <tr>
      <td>$module_name</td>
      <td>string</td>
      <td>请求包含的模块名</td>
      <td>
      	<small>
                QContext        		</small>
      </td>
    </tr>
    
    <tr>
      <td>$namespace</td>
      <td>string</td>
      <td>请求包含的命名空间</td>
      <td>
      	<small>
                QContext        		</small>
      </td>
    </tr>
    
    <tr>
      <td>$controller_name</td>
      <td>string</td>
      <td>请求包含的控制器名称</td>
      <td>
      	<small>
                QContext        		</small>
      </td>
    </tr>
    
    <tr>
      <td>$action_name</td>
      <td>string</td>
      <td>请求包含的动作名</td>
      <td>
      	<small>
                QContext        		</small>
      </td>
    </tr>
    
  </table>
</div>



  <a name="methods"></a>
  
<div class="summary">
  <h2>公共方法</h2>
  <p>
    <a href="#" class="toggle">隐藏继承的方法</a>
  </p>

  <table class="list-table table table-bordered">
    <tr>
      <th>方法</th><th>描述</th><th>定义于</th>
    </tr>

        <tr>
      <td>
        <a href="#QContext_reinit">reinit()</a>
      </td>

      <td>根据服务器运行环境，重新初始化 QContext 对象</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_instance">instance()</a>
      </td>

      <td>返回 QContext 对象的唯一实例</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext___get">__get()</a>
      </td>

      <td>魔法方法，访问请求参数</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext___set">__set()</a>
      </td>

      <td>魔法方法，设置附加参数</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext___isset">__isset()</a>
      </td>

      <td>魔法方法，确定是否包含指定的参数</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext___unset">__unset()</a>
      </td>

      <td>删除指定的附加参数</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_offsetExists">offsetExists()</a>
      </td>

      <td>确定是否包含指定的参数，实现 ArrayAccess 接口</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_offsetSet">offsetSet()</a>
      </td>

      <td>设置附加参数，实现 ArrayAccess 接口</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_offsetGet">offsetGet()</a>
      </td>

      <td>访问请求参数，实现 ArrayAccess 接口</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_offsetUnset">offsetUnset()</a>
      </td>

      <td>取消附加参数，实现 ArrayAccess 接口</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_query">query()</a>
      </td>

      <td>魔法方法，访问请求参数</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_get">get()</a>
      </td>

      <td>获得 GET 数据</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_post">post()</a>
      </td>

      <td>获得 POST 数据</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_cookie">cookie()</a>
      </td>

      <td>获得 Cookie 数据</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_server">server()</a>
      </td>

      <td>从 $_SERVER 查询服务器运行环境数据</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_env">env()</a>
      </td>

      <td>从 $_ENV 查询服务器运行环境数据</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_changeParam">changeParam()</a>
      </td>

      <td>设置 QContext 对象的附加参数</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_param">param()</a>
      </td>

      <td>获得 QContext 对象的附加参数</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_params">params()</a>
      </td>

      <td>返回所有上下文参数</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_protocol">protocol()</a>
      </td>

      <td>取得当前请求使用的协议</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_changeRequestUri">changeRequestUri()</a>
      </td>

      <td>设置 REQUEST_URI</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_requestUri">requestUri()</a>
      </td>

      <td>确定请求的完整 URL</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_baseUri">baseUri()</a>
      </td>

      <td>返回不包含任何查询参数的 URI（但包含脚本名称）</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_baseDir">baseDir()</a>
      </td>

      <td>返回请求 URL 中的基础路径（不包含脚本名称）</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_serverPort">serverPort()</a>
      </td>

      <td>返回服务器响应请求使用的端口</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_scriptName">scriptName()</a>
      </td>

      <td>获得响应请求的脚本文件名</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_pathinfo">pathinfo()</a>
      </td>

      <td>返回 PATHINFO 信息</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_requestMethod">requestMethod()</a>
      </td>

      <td>返回请求使用的方法</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_isGET">isGET()</a>
      </td>

      <td>是否是 GET 请求</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_isPOST">isPOST()</a>
      </td>

      <td>是否是 POST 请求</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_isPUT">isPUT()</a>
      </td>

      <td>是否是 PUT 请求</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_isDELETE">isDELETE()</a>
      </td>

      <td>是否是 DELETE 请求</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_isHEAD">isHEAD()</a>
      </td>

      <td>是否是 HEAD 请求</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_isOPTIONS">isOPTIONS()</a>
      </td>

      <td>是否是 OPTIONS 请求</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_isAJAX">isAJAX()</a>
      </td>

      <td>判断 HTTP 请求是否是通过 XMLHttp 发起的</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_isFlash">isFlash()</a>
      </td>

      <td>判断 HTTP 请求是否是通过 Flash 发起的</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_requestRawBody">requestRawBody()</a>
      </td>

      <td>返回请求的原始内容</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_header">header()</a>
      </td>

      <td>返回 HTTP 请求头中的指定信息，如果没有指定参数则返回 false</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_referer">referer()</a>
      </td>

      <td>返回当前请求的参照 URL</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_router">router()</a>
      </td>

      <td>返回当前使用的路由服务对象</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_url">url()</a>
      </td>

      <td>构造 url</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_UDIString">UDIString()</a>
      </td>

      <td>返回 UDI 的字符串表现形式</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_normalizeUDI">normalizeUDI()</a>
      </td>

      <td>返回规范化以后的 UDI 数组</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_requestUDI">requestUDI()</a>
      </td>

      <td>返回当前请求对应的 UDI</td>
      <td>
                QContext        
      </td>
    </tr>
        <tr>
      <td>
        <a href="#QContext_changeRequestUDI">changeRequestUDI()</a>
      </td>

      <td>将 QContext 对象保存的请求参数设置为 UDI 指定的值</td>
      <td>
                QContext        
      </td>
    </tr>
    
  </table>
</div>



<div class="details">

  <h2>属性详细说明</h2>

    
  <a name="module_name"></a>

  <div class="name property">
    <strong>$module_name</strong>

    <span class="tags">属性</span>
  </div>

  <div class="signature">
      </div>

  <div class="formatted">
    
<p>请求包含的模块名</p>

<p>为了性能原因，$module_name 设置为了 public 成员变量。
但开发者应该使用 changeRequestUDI() 方法来修改 $module_name
等变量。</p>
  </div>

    
  <a name="namespace"></a>

  <div class="name property">
    <strong>$namespace</strong>

    <span class="tags">属性</span>
  </div>

  <div class="signature">
      </div>

  <div class="formatted">
    
<p>请求包含的命名空间</p>
  </div>

    
  <a name="controller_name"></a>

  <div class="name property">
    <strong>$controller_name</strong>

    <span class="tags">属性</span>
  </div>

  <div class="signature">
      </div>

  <div class="formatted">
    
<p>请求包含的控制器名称</p>
  </div>

    
  <a name="action_name"></a>

  <div class="name property">
    <strong>$action_name</strong>

    <span class="tags">属性</span>
  </div>

  <div class="signature">
      </div>

  <div class="formatted">
    
<p>请求包含的动作名</p>
  </div>

    
  <a name="_params"></a>

  <div class="name property">
    <strong>$_params</strong>

    <span class="tags">属性</span>
  </div>

  <div class="signature">
      </div>

  <div class="formatted">
    
<p>附加的参数</p>
  </div>

    
  <a name="_router"></a>

  <div class="name property">
    <strong>$_router</strong>

    <span class="tags">属性</span>
  </div>

  <div class="signature">
      </div>

  <div class="formatted">
    
<p>路由对象</p>
  </div>

    
  <a name="_request_uri"></a>

  <div class="name property">
    <strong>$_request_uri</strong>

    <span class="tags">属性</span>
  </div>

  <div class="signature">
      </div>

  <div class="formatted">
    
<p>当前请求 URL</p>
  </div>

    
  <a name="_base_uri"></a>

  <div class="name property">
    <strong>$_base_uri</strong>

    <span class="tags">属性</span>
  </div>

  <div class="signature">
      </div>

  <div class="formatted">
    
<p>当前请求 URL 不包含查询参数的部分</p>
  </div>

    
  <a name="_base_dir"></a>

  <div class="name property">
    <strong>$_base_dir</strong>

    <span class="tags">属性</span>
  </div>

  <div class="signature">
      </div>

  <div class="formatted">
    
<p>当前请求 URL 的目录部分</p>
  </div>

    
  <a name="_url_mode"></a>

  <div class="name property">
    <strong>$_url_mode</strong>

    <span class="tags">属性</span>
  </div>

  <div class="signature">
      </div>

  <div class="formatted">
    
<p>路由模式</p>
  </div>

    
  <a name="_udi_defaults"></a>

  <div class="name property">
    <strong>$_udi_defaults</strong>

    <span class="tags">属性</span>
  </div>

  <div class="signature">
      </div>

  <div class="formatted">
    
<p>UDI 的默认值</p>
  </div>

  
</div>


<div class="details">

  <h2>方法详细说明</h2>

      
  <a name="QContext_reinit"></a>

  <h4 class="name method">
    reinit()
    <span class="tags">方法</span>
  </h4>
	<p>
	public void <strong>reinit</strong>($full_init)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$full_init</td>
      <td class="param_type">boolean</td>
      <td class="param_desc">是否进行完全的初始化</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type"></td>
      <td class="param_desc"></td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>根据服务器运行环境，重新初始化 QContext 对象</p>
  </div>
	<hr>
    
  <a name="QContext_instance"></a>

  <h4 class="name method">
    instance()
    <span class="tags">方法</span>
  </h4>
	<p>
	public static QContext <strong>instance</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>返回 QContext 对象的唯一实例</p>

<pre class="php code"><span class="re0">$context</span> <span
class="sy0">=</span> QContext<span class="sy0">::</span><span
class="me2">instance</span><span class="br0">&#40;</span><span
class="br0">&#41;</span><span class="sy0">;</span></pre>
  </div>
	<hr>
    
  <a name="QContext___get"></a>

  <h4 class="name method">
    __get()
    <span class="tags">方法</span>
  </h4>
	<p>
	public mixed <strong>__get</strong>($parameter)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$parameter</td>
      <td class="param_type">string</td>
      <td class="param_desc">要访问的请求参数</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数值</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>魔法方法，访问请求参数</p>

<p>__get() 魔法方法让开发者可以用 $context-&gt;parameter
的形式访问请求参数。 如果指定的参数不存在，则返回
null。</p>

<pre class="php code"><span class="re0">$title</span> <span
class="sy0">=</span> <span class="re0">$context</span><span
class="sy0">-&gt;</span><span class="me1">title</span><span
class="sy0">;</span></pre>

<p>查找请求参数的顺行是 $_GET、$_POST 和 QContext
对象附加参数。</p>
  </div>
	<hr>
    
  <a name="QContext___set"></a>

  <h4 class="name method">
    __set()
    <span class="tags">方法</span>
  </h4>
	<p>
	public void <strong>__set</strong>($parameter, $value)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$parameter</td>
      <td class="param_type">string</td>
      <td class="param_desc">要设置值的参数名</td>
    </tr>
    
    <tr>
      <td class="param_name">$value</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数值</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type"></td>
      <td class="param_desc"></td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>魔法方法，设置附加参数</p>

<p>与 __get() 魔法方法不同，__set() 仅仅设置 QContext
对象附加参数。 因此当 $_GET 或 $_POST 中包含同名参数时，用
__set() 设置的参数值 只能使用 QContext::param() 方法来获得。</p>

<pre class="php code"><span class="re0">$context</span><span
class="sy0">-&gt;</span><span class="me1">title</span> <span
class="sy0">=</span> <span class="re0">$title</span><span
class="sy0">;</span>
<span class="kw3">echo</span> <span
class="re0">$context</span><span class="sy0">-&gt;</span><span
class="me1">param</span><span class="br0">&#40;</span><span
class="st_h">'title'</span><span class="br0">&#41;</span><span
class="sy0">;</span></pre>
  </div>
	<hr>
    
  <a name="QContext___isset"></a>

  <h4 class="name method">
    __isset()
    <span class="tags">方法</span>
  </h4>
	<p>
	public boolean <strong>__isset</strong>($parameter)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$parameter</td>
      <td class="param_type">string</td>
      <td class="param_desc">要检查的参数</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">boolean</td>
      <td class="param_desc">是否具有指定参数</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>魔法方法，确定是否包含指定的参数</p>
  </div>
	<hr>
    
  <a name="QContext___unset"></a>

  <h4 class="name method">
    __unset()
    <span class="tags">方法</span>
  </h4>
	<p>
	public void <strong>__unset</strong>($parameter)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$parameter</td>
      <td class="param_type">string</td>
      <td class="param_desc">要删除的参数</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type"></td>
      <td class="param_desc"></td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>删除指定的附加参数</p>

<p>__unset() 魔法方法只影响 QContext 对象的附加参数。</p>

<pre class="php code"><span class="kw3">unset</span><span
class="br0">&#40;</span><span class="re0">$context</span><span
class="br0">&#91;</span><span class="st_h">'title'</span><span
class="br0">&#93;</span><span class="br0">&#41;</span><span
class="sy0">;</span>
<span
class="co1">// 此时读取 title 附加参数将获得 null</span>
<span
class="kw3">echo</span> <span class="re0">$context</span><span
class="sy0">-&gt;</span><span class="me1">param</span><span
class="br0">&#40;</span><span class="st_h">'title'</span><span
class="br0">&#41;</span><span class="sy0">;</span></pre>
  </div>
	<hr>
    
  <a name="QContext_offsetExists"></a>

  <h4 class="name method">
    offsetExists()
    <span class="tags">方法</span>
  </h4>
	<p>
	public boolean <strong>offsetExists</strong>($parameter)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$parameter</td>
      <td class="param_type">string</td>
      <td class="param_desc">要检查的参数</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">boolean</td>
      <td class="param_desc">参数是否存在</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>确定是否包含指定的参数，实现 ArrayAccess 接口</p>

<pre class="php code"><span class="kw3">echo</span> <span
class="kw3">isset</span><span class="br0">&#40;</span><span
class="re0">$context</span><span class="br0">&#91;</span><span
class="st_h">'title'</span><span class="br0">&#93;</span><span
class="br0">&#41;</span><span class="sy0">;</span></pre>
  </div>
	<hr>
    
  <a name="QContext_offsetSet"></a>

  <h4 class="name method">
    offsetSet()
    <span class="tags">方法</span>
  </h4>
	<p>
	public void <strong>offsetSet</strong>($parameter, $value)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$parameter</td>
      <td class="param_type">string</td>
      <td class="param_desc">要设置的参数</td>
    </tr>
    
    <tr>
      <td class="param_name">$value</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数值</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type"></td>
      <td class="param_desc"></td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>设置附加参数，实现 ArrayAccess 接口</p>

<p>该方法功能同 __set() 魔法方法。</p>

<pre class="php code"><span class="re0">$context</span><span
class="br0">&#91;</span><span class="st_h">'title'</span><span
class="br0">&#93;</span> <span class="sy0">=</span> <span
class="re0">$title</span><span class="sy0">;</span>
<span
class="kw3">echo</span> <span class="re0">$context</span><span
class="sy0">-&gt;</span><span class="me1">param</span><span
class="br0">&#40;</span><span class="st_h">'title'</span><span
class="br0">&#41;</span><span class="sy0">;</span></pre>
  </div>
	<hr>
    
  <a name="QContext_offsetGet"></a>

  <h4 class="name method">
    offsetGet()
    <span class="tags">方法</span>
  </h4>
	<p>
	public mixed <strong>offsetGet</strong>($parameter)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$parameter</td>
      <td class="param_type">string</td>
      <td class="param_desc">要访问的请求参数</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数值</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>访问请求参数，实现 ArrayAccess 接口</p>

<pre class="php code"><span class="re0">$title</span> <span
class="sy0">=</span> <span class="re0">$context</span><span
class="br0">&#91;</span><span class="st_h">'title'</span><span
class="br0">&#93;</span><span class="sy0">;</span></pre>
  </div>
	<hr>
    
  <a name="QContext_offsetUnset"></a>

  <h4 class="name method">
    offsetUnset()
    <span class="tags">方法</span>
  </h4>
	<p>
	public void <strong>offsetUnset</strong>($parameter)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$parameter</td>
      <td class="param_type">string</td>
      <td class="param_desc">要取消的附加参数</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type"></td>
      <td class="param_desc"></td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>取消附加参数，实现 ArrayAccess 接口</p>

<p>同 __unset() 方法，QContext::offsetUnset() 只影响 QContext
对象的附加参数。</p>

<pre class="php code"><span class="kw3">unset</span><span
class="br0">&#40;</span><span class="re0">$context</span><span
class="br0">&#91;</span><span class="st_h">'title'</span><span
class="br0">&#93;</span><span class="br0">&#41;</span><span
class="sy0">;</span></pre>
  </div>
	<hr>
    
  <a name="QContext_query"></a>

  <h4 class="name method">
    query()
    <span class="tags">方法</span>
  </h4>
	<p>
	public mixed <strong>query</strong>($parameter, $default)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$parameter</td>
      <td class="param_type">string</td>
      <td class="param_desc">要访问的请求参数</td>
    </tr>
    
    <tr>
      <td class="param_name">$default</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数不存在时要返回的默认值</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数值</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>魔法方法，访问请求参数</p>

<p>QContext::get() 方法让开发者可以用 $context-&gt;parameter
的形式访问请求参数。 如果指定的参数不存在，则返回
$default 参数指定的默认值。</p>

<pre class="php code"><span class="re0">$title</span> <span
class="sy0">=</span> <span class="re0">$context</span><span
class="sy0">-&gt;</span><span class="me1">query</span><span
class="br0">&#40;</span><span class="st_h">'title'</span><span
class="sy0">,</span> <span class="st_h">'default title'</span><span
class="br0">&#41;</span><span class="sy0">;</span></pre>

<p>查找请求参数的顺行是$_POST、$_GET、$_REQUEST 和 QContext
对象附加参数。</p>
  </div>
	<hr>
    
  <a name="QContext_get"></a>

  <h4 class="name method">
    get()
    <span class="tags">方法</span>
  </h4>
	<p>
	public mixed <strong>get</strong>($parameter, $default)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$parameter</td>
      <td class="param_type">string</td>
      <td class="param_desc">要查询的参数名</td>
    </tr>
    
    <tr>
      <td class="param_name">$default</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数不存在时要返回的默认值</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数值</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>获得 GET 数据</p>

<p>从 $_GET 中获得指定参数，如果参数不存在则返回 $default
指定的默认值。</p>

<pre class="php code"><span class="re0">$title</span> <span
class="sy0">=</span> <span class="re0">$context</span><span
class="sy0">-&gt;</span><span class="me1">get</span><span
class="br0">&#40;</span><span class="st_h">'title'</span><span
class="sy0">,</span> <span class="st_h">'default title'</span><span
class="br0">&#41;</span><span class="sy0">;</span></pre>

<p>如果 $parameter 参数为 null，则返回整个 $_GET 的内容。</p>
  </div>
	<hr>
    
  <a name="QContext_post"></a>

  <h4 class="name method">
    post()
    <span class="tags">方法</span>
  </h4>
	<p>
	public mixed <strong>post</strong>($parameter, $default)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$parameter</td>
      <td class="param_type">string</td>
      <td class="param_desc">要查询的参数名</td>
    </tr>
    
    <tr>
      <td class="param_name">$default</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数不存在时要返回的默认值</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数值</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>获得 POST 数据</p>

<p>从 $_POST 中获得指定参数，如果参数不存在则返回 $default
指定的默认值。</p>

<pre class="php code"><span class="re0">$body</span> <span
class="sy0">=</span> <span class="re0">$context</span><span
class="sy0">-&gt;</span><span class="me1">post</span><span
class="br0">&#40;</span><span class="st_h">'body'</span><span
class="sy0">,</span> <span class="st_h">'default body'</span><span
class="br0">&#41;</span><span class="sy0">;</span></pre>

<p>如果 $parameter 参数为 null，则返回整个 $_POST 的内容。</p>
  </div>
	<hr>
    
  <a name="QContext_cookie"></a>

  <h4 class="name method">
    cookie()
    <span class="tags">方法</span>
  </h4>
	<p>
	public mixed <strong>cookie</strong>($parameter, $default)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$parameter</td>
      <td class="param_type">string</td>
      <td class="param_desc">要查询的参数名</td>
    </tr>
    
    <tr>
      <td class="param_name">$default</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数不存在时要返回的默认值</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数值</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>获得 Cookie 数据</p>

<p>从 $_COOKIE 中获得指定参数，如果参数不存在则返回 $default
指定的默认值。</p>

<pre class="php code"><span class="re0">$auto_login</span> <span
class="sy0">=</span> <span class="re0">$context</span><span
class="sy0">-&gt;</span><span class="me1">cookie</span><span
class="br0">&#40;</span><span class="st_h">'auto_login'</span><span
class="br0">&#41;</span><span class="sy0">;</span></pre>

<p>如果 $parameter 参数为 null，则返回整个 $_COOKIE 的内容。</p>
  </div>
	<hr>
    
  <a name="QContext_server"></a>

  <h4 class="name method">
    server()
    <span class="tags">方法</span>
  </h4>
	<p>
	public mixed <strong>server</strong>($parameter, $default)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$parameter</td>
      <td class="param_type">string</td>
      <td class="param_desc">要查询的参数名</td>
    </tr>
    
    <tr>
      <td class="param_name">$default</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数不存在时要返回的默认值</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数值</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>从 $_SERVER 查询服务器运行环境数据</p>

<p>如果参数不存在则返回 $default 指定的默认值。</p>

<pre class="php code"><span class="re0">$request_time</span> <span
class="sy0">=</span> <span class="re0">$context</span><span
class="sy0">-&gt;</span><span class="me1">server</span><span
class="br0">&#40;</span><span class="st_h">'REQUEST_TIME'</span><span
class="br0">&#41;</span><span class="sy0">;</span></pre>

<p>如果 $parameter 参数为 null，则返回整个 $_SERVER 的内容。</p>
  </div>
	<hr>
    
  <a name="QContext_env"></a>

  <h4 class="name method">
    env()
    <span class="tags">方法</span>
  </h4>
	<p>
	public mixed <strong>env</strong>($parameter, $default)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$parameter</td>
      <td class="param_type">string</td>
      <td class="param_desc">要查询的参数名</td>
    </tr>
    
    <tr>
      <td class="param_name">$default</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数不存在时要返回的默认值</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数值</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>从 $_ENV 查询服务器运行环境数据</p>

<p>如果参数不存在则返回 $default 指定的默认值。</p>

<pre class="php code"><span class="re0">$os_type</span> <span
class="sy0">=</span> <span class="re0">$context</span><span
class="sy0">-&gt;</span><span class="me1">env</span><span
class="br0">&#40;</span><span class="st_h">'OS'</span><span
class="sy0">,</span> <span class="st_h">'non-win'</span><span
class="br0">&#41;</span><span class="sy0">;</span></pre>

<p>如果 $parameter 参数为 null，则返回整个 $_ENV 的内容。</p>
  </div>
	<hr>
    
  <a name="QContext_changeParam"></a>

  <h4 class="name method">
    changeParam()
    <span class="tags">方法</span>
  </h4>
	<p>
	public QContext <strong>changeParam</strong>($parameter, $value)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$parameter</td>
      <td class="param_type">string</td>
      <td class="param_desc">要设置的参数名</td>
    </tr>
    
    <tr>
      <td class="param_name">$value</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数值</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">QContext</td>
      <td class="param_desc">返回 QContext 对象本身，实现连贯接口</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>设置 QContext 对象的附加参数</p>

<pre class="php code"><span class="re0">$context</span><span
class="sy0">-&gt;</span><span class="me1">changeParam</span><span
class="br0">&#40;</span><span class="st_h">'arg'</span><span
class="sy0">,</span> <span class="re0">$value</span><span
class="br0">&#41;</span><span class="sy0">;</span></pre>
  </div>
	<hr>
    
  <a name="QContext_param"></a>

  <h4 class="name method">
    param()
    <span class="tags">方法</span>
  </h4>
	<p>
	public mixed <strong>param</strong>($parameter, $default)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$parameter</td>
      <td class="param_type">string</td>
      <td class="param_desc">要查询的参数名</td>
    </tr>
    
    <tr>
      <td class="param_name">$default</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数不存在时要返回的默认值</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">mixed</td>
      <td class="param_desc">参数值</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>获得 QContext 对象的附加参数</p>

<p>如果参数不存在则返回 $default 指定的默认值。</p>

<pre class="php code"><span class="re0">$value</span> <span
class="sy0">=</span> <span class="re0">$context</span><span
class="sy0">-&gt;</span><span class="me1">param</span><span
class="br0">&#40;</span><span class="st_h">'arg'</span><span
class="sy0">,</span> <span class="st_h">'default value'</span><span
class="br0">&#41;</span><span class="sy0">;</span></pre>

<p>如果 $parameter 参数为
null，则返回所有附加参数的内容。</p>
  </div>
	<hr>
    
  <a name="QContext_params"></a>

  <h4 class="name method">
    params()
    <span class="tags">方法</span>
  </h4>
	<p>
	public array <strong>params</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>返回所有上下文参数</p>
  </div>
	<hr>
    
  <a name="QContext_protocol"></a>

  <h4 class="name method">
    protocol()
    <span class="tags">方法</span>
  </h4>
	<p>
	public string <strong>protocol</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>取得当前请求使用的协议</p>

<p>返回值不包含协议的版本。常见的返回值是 HTTP。</p>

<pre class="php code"><span class="re0">$protocol</span> <span
class="sy0">=</span> <span class="re0">$context</span><span
class="sy0">-&gt;</span><span class="me1">protocol</span><span
class="br0">&#40;</span><span class="br0">&#41;</span><span
class="sy0">;</span>
<span class="kw3">echo</span> <span
class="re0">$protocol</span><span class="sy0">;</span></pre>
  </div>
	<hr>
    
  <a name="QContext_changeRequestUri"></a>

  <h4 class="name method">
    changeRequestUri()
    <span class="tags">方法</span>
  </h4>
	<p>
	public QContext <strong>changeRequestUri</strong>($request_uri)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$request_uri</td>
      <td class="param_type">string</td>
      <td class="param_desc">新的 REQUEST_URI 值</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">QContext</td>
      <td class="param_desc">返回 QContext 对象本身，实现连贯接口</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>设置 REQUEST_URI</p>

<p>这项修改不会影响 $_SERVER 中值，但是修改后
QContext::requestUri() 将返回新值。 同时还影响 QContext::baseUri()
和 QContext::baseDir() 的返回结果。</p>
  </div>
	<hr>
    
  <a name="QContext_requestUri"></a>

  <h4 class="name method">
    requestUri()
    <span class="tags">方法</span>
  </h4>
	<p>
	public string <strong>requestUri</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>确定请求的完整 URL</p>

<p>几个示例：</p>

<ul>
	<li>请求 <a
	href="http://www.example.com/index.php?controller=posts&amp;action=create">http://www.example.com/index.php?controller=posts&action=create</a></li>

	<li>返回 /index.php?controller=posts&amp;action=create</li>
</ul>

<ul>
	<li>请求 <a
	href="http://www.example.com/news/index.php?controller=posts&amp;action=create">http://www.example.com/news/index.php?controller=posts&action=create</a></li>

	<li>返回 /news/index.php?controller=posts&amp;action=create</li>
</ul>

<ul>
	<li>请求 <a
	href="http://www.example.com/index.php/posts/create">http://www.example.com/index.php/posts/create</a></li>

	<li>返回 /index.php/posts/create</li>
</ul>

<ul>
	<li>请求 <a
	href="http://www.example.com/news/show/id/1">http://www.example.com/news/show/id/1</a></li>

	<li>返回 /news/show/id/1</li>
</ul>

<p>此方法参考 Zend Framework 实现。</p>
  </div>
	<hr>
    
  <a name="QContext_baseUri"></a>

  <h4 class="name method">
    baseUri()
    <span class="tags">方法</span>
  </h4>
	<p>
	public string <strong>baseUri</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>返回不包含任何查询参数的 URI（但包含脚本名称）</p>

<p>几个示例：</p>

<ul>
	<li>请求 <a
	href="http://www.example.com/index.php?controller=posts&amp;action=create">http://www.example.com/index.php?controller=posts&action=create</a></li>

	<li>返回 /index.php</li>
</ul>

<ul>
	<li>请求 <a
	href="http://www.example.com/news/index.php?controller=posts&amp;action=create">http://www.example.com/news/index.php?controller=posts&action=create</a></li>

	<li>返回 /news/index.php</li>
</ul>

<ul>
	<li>请求 <a
	href="http://www.example.com/index.php/posts/create">http://www.example.com/index.php/posts/create</a></li>

	<li>返回 /index.php</li>
</ul>

<ul>
	<li>请求 <a
	href="http://www.example.com/news/show/id/1">http://www.example.com/news/show/id/1</a></li>

	<li>返回 /news/show/id/1</li>

	<li>假设使用了 URL 重写，并且 index.php 位于根目录</li>
</ul>

<p>此方法参考 Zend Framework 实现。</p>
  </div>
	<hr>
    
  <a name="QContext_baseDir"></a>

  <h4 class="name method">
    baseDir()
    <span class="tags">方法</span>
  </h4>
	<p>
	public string <strong>baseDir</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>返回请求 URL 中的基础路径（不包含脚本名称）</p>

<p>几个示例：</p>

<ul>
	<li>请求 <a
	href="http://www.example.com/index.php?controller=posts&amp;action=create">http://www.example.com/index.php?controller=posts&action=create</a></li>

	<li>返回 /</li>
</ul>

<ul>
	<li>请求 <a
	href="http://www.example.com/news/index.php?controller=posts&amp;action=create">http://www.example.com/news/index.php?controller=posts&action=create</a></li>

	<li>返回 /news/</li>
</ul>

<ul>
	<li>请求 <a
	href="http://www.example.com/index.php/posts/create">http://www.example.com/index.php/posts/create</a></li>

	<li>返回 /</li>
</ul>

<ul>
	<li>请求 <a
	href="http://www.example.com/news/show/id/1">http://www.example.com/news/show/id/1</a></li>

	<li>返回 /</li>
</ul>
  </div>
	<hr>
    
  <a name="QContext_serverPort"></a>

  <h4 class="name method">
    serverPort()
    <span class="tags">方法</span>
  </h4>
	<p>
	public string <strong>serverPort</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>返回服务器响应请求使用的端口</p>

<p>通常服务器使用 80
端口与客户端通信，该方法可以获得服务器所使用的端口号。</p>
  </div>
	<hr>
    
  <a name="QContext_scriptName"></a>

  <h4 class="name method">
    scriptName()
    <span class="tags">方法</span>
  </h4>
	<p>
	public string <strong>scriptName</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>获得响应请求的脚本文件名</p>
  </div>
	<hr>
    
  <a name="QContext_pathinfo"></a>

  <h4 class="name method">
    pathinfo()
    <span class="tags">方法</span>
  </h4>
	<p>
	public string <strong>pathinfo</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>返回 PATHINFO 信息</p>

<ul>
	<li>请求 <a
	href="http://www.example.com/index.php?controller=posts&amp;action=create">http://www.example.com/index.php?controller=posts&action=create</a></li>

	<li>返回 /</li>
</ul>

<ul>
	<li>请求 <a
	href="http://www.example.com/news/index.php?controller=posts&amp;action=create">http://www.example.com/news/index.php?controller=posts&action=create</a></li>

	<li>返回 /</li>
</ul>

<ul>
	<li>请求 <a
	href="http://www.example.com/index.php/posts/create">http://www.example.com/index.php/posts/create</a></li>

	<li>返回 /</li>
</ul>

<ul>
	<li>请求 <a
	href="http://www.example.com/news/show/id/1">http://www.example.com/news/show/id/1</a></li>

	<li>返回 /news/show/id/1</li>

	<li>假设使用了 URL 重写，并且 index.php 位于根目录</li>
</ul>

<p>此方法参考 Zend Framework 实现。</p>
  </div>
	<hr>
    
  <a name="QContext_requestMethod"></a>

  <h4 class="name method">
    requestMethod()
    <span class="tags">方法</span>
  </h4>
	<p>
	public string <strong>requestMethod</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>返回请求使用的方法</p>
  </div>
	<hr>
    
  <a name="QContext_isGET"></a>

  <h4 class="name method">
    isGET()
    <span class="tags">方法</span>
  </h4>
	<p>
	public boolean <strong>isGET</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>是否是 GET 请求</p>
  </div>
	<hr>
    
  <a name="QContext_isPOST"></a>

  <h4 class="name method">
    isPOST()
    <span class="tags">方法</span>
  </h4>
	<p>
	public boolean <strong>isPOST</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>是否是 POST 请求</p>
  </div>
	<hr>
    
  <a name="QContext_isPUT"></a>

  <h4 class="name method">
    isPUT()
    <span class="tags">方法</span>
  </h4>
	<p>
	public boolean <strong>isPUT</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>是否是 PUT 请求</p>
  </div>
	<hr>
    
  <a name="QContext_isDELETE"></a>

  <h4 class="name method">
    isDELETE()
    <span class="tags">方法</span>
  </h4>
	<p>
	public boolean <strong>isDELETE</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>是否是 DELETE 请求</p>
  </div>
	<hr>
    
  <a name="QContext_isHEAD"></a>

  <h4 class="name method">
    isHEAD()
    <span class="tags">方法</span>
  </h4>
	<p>
	public boolean <strong>isHEAD</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>是否是 HEAD 请求</p>
  </div>
	<hr>
    
  <a name="QContext_isOPTIONS"></a>

  <h4 class="name method">
    isOPTIONS()
    <span class="tags">方法</span>
  </h4>
	<p>
	public boolean <strong>isOPTIONS</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>是否是 OPTIONS 请求</p>
  </div>
	<hr>
    
  <a name="QContext_isAJAX"></a>

  <h4 class="name method">
    isAJAX()
    <span class="tags">方法</span>
  </h4>
	<p>
	public boolean <strong>isAJAX</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>判断 HTTP 请求是否是通过 XMLHttp 发起的</p>
  </div>
	<hr>
    
  <a name="QContext_isFlash"></a>

  <h4 class="name method">
    isFlash()
    <span class="tags">方法</span>
  </h4>
	<p>
	public boolean <strong>isFlash</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>判断 HTTP 请求是否是通过 Flash 发起的</p>
  </div>
	<hr>
    
  <a name="QContext_requestRawBody"></a>

  <h4 class="name method">
    requestRawBody()
    <span class="tags">方法</span>
  </h4>
	<p>
	public string <strong>requestRawBody</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>返回请求的原始内容</p>
  </div>
	<hr>
    
  <a name="QContext_header"></a>

  <h4 class="name method">
    header()
    <span class="tags">方法</span>
  </h4>
	<p>
	public string <strong>header</strong>($header)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$header</td>
      <td class="param_type">string</td>
      <td class="param_desc">要查询的请求头参数</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">string</td>
      <td class="param_desc">参数值</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>返回 HTTP 请求头中的指定信息，如果没有指定参数则返回
false</p>
  </div>
	<hr>
    
  <a name="QContext_referer"></a>

  <h4 class="name method">
    referer()
    <span class="tags">方法</span>
  </h4>
	<p>
	public string <strong>referer</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>返回当前请求的参照 URL</p>
  </div>
	<hr>
    
  <a name="QContext_router"></a>

  <h4 class="name method">
    router()
    <span class="tags">方法</span>
  </h4>
	<p>
	public QRouter <strong>router</strong>()	</p>
  <table class="list-table table table-bordered">

    
  </table>

  <div class="formatted">
    
<p>返回当前使用的路由服务对象</p>

<p>如果没有启动路由，则返回 null。</p>
  </div>
	<hr>
    
  <a name="QContext_url"></a>

  <h4 class="name method">
    url()
    <span class="tags">方法</span>
  </h4>
	<p>
	public string <strong>url</strong>($udi, $params, $route_name, $opts)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$udi</td>
      <td class="param_type">string</td>
      <td class="param_desc">UDI 字符串</td>
    </tr>
    
    <tr>
      <td class="param_name">$params</td>
      <td class="param_type">array|string</td>
      <td class="param_desc">附加参数数组</td>
    </tr>
    
    <tr>
      <td class="param_name">$route_name</td>
      <td class="param_type">string</td>
      <td class="param_desc">路由名</td>
    </tr>
    
    <tr>
      <td class="param_name">$opts</td>
      <td class="param_type">array</td>
      <td class="param_desc">控制如何生成 URL 的选项</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">string</td>
      <td class="param_desc">生成的 URL 地址</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>构造 url</p>

<p>用法：</p>

<pre class="php code">url<span class="br0">&#40;</span>UDI<span
class="sy0">,</span> <span class="br0">&#91;</span>附加参数数组<span
class="br0">&#93;</span><span class="sy0">,</span> <span
class="br0">&#91;</span>路由名<span class="br0">&#93;</span><span
class="br0">&#41;</span></pre>

<p>UDI 是统一目的地标识符（Uniform Destination
Identifier）的缩写。 UDI
由控制器、动作、名字空间以及模块名组成，采用如下的格式：</p>

<pre class="php code">namespace<span class="sy0">::</span><span
class="me2">controller</span><span class="sy0">/</span>action<span
class="sy0">@</span>module</pre>

<p>UDI 字符串中，每一个部分都是可选的。
如果没有提供控制器和动作名，则使用当前的控制器和默认动作名（index）代替。
同样，如果未提供模块名和名字空间，均使用当前值代替。</p>

<p>UDI 字符串写法示例：</p>

<pre class="php code"><span class="st_h">'controller'</span>
<span
class="st_h">'controller/action'</span>
<span
class="st_h">'/action'</span>
<span
class="st_h">'controller@module'</span>
<span
class="st_h">'controller/action@module'</span>
<span
class="st_h">'namespace::controller'</span>
<span
class="st_h">'namespace::controller/action'</span>
<span
class="st_h">'namespace::controller@module'</span>
<span
class="st_h">'namespace::controller/action@module'</span>
<span
class="st_h">'@module'</span>
<span
class="st_h">'namespace::@module'</span></pre>

<p>示例：</p>

<pre class="php code">url<span class="br0">&#40;</span><span
class="st_h">'admin::posts/edit'</span><span class="sy0">,</span> <span
class="kw3">array</span><span class="br0">&#40;</span><span
class="st_h">'id'</span> <span class="sy0">=&gt;</span> <span
class="re0">$post</span><span class="sy0">-&gt;</span><span
class="me1">id</span><span class="br0">&#40;</span><span
class="br0">&#41;</span><span class="br0">&#41;</span><span
class="br0">&#41;</span><span class="sy0">;</span></pre>

<p>$params
参数除了采用数组，还可以是以“/”符号分割的字符串：</p>

<pre class="php code">url<span class="br0">&#40;</span><span
class="st_h">'posts/index'</span><span class="sy0">,</span> <span
class="st_h">'page/3'</span><span class="br0">&#41;</span><span
class="sy0">;</span>
url<span class="br0">&#40;</span><span
class="st_h">'users/show'</span><span class="sy0">,</span> <span
class="st_h">'id/5/profile/yes'</span><span class="br0">&#41;</span><span
class="sy0">;</span></pre>

<p>在使用 PATHINFO 和 URL
重写时，可以使用通过制定路由名来强制要求 QeePHP
采用指定的路由规则来生成 URL。强制指定路由规则可以加快
URL 的生成， 但在路由规则名称发生变化时，需要修改生成
URL 的代码。</p>

<p>$opts 参数用于控制如何生成 URL。可用的选项有：</p>

<ul>
	<li>base_uri: 指定 URL
	前部要添加的路径（可以包括协议、域名和端口，以及路径）</li>

	<li>script: 指定 URL 前部要使用的脚本名</li>

	<li>mode: 指定 URL 生成模式，可以是 standard、pathinfo 和
	rewrite</li>
</ul>
  </div>
	<hr>
    
  <a name="QContext_UDIString"></a>

  <h4 class="name method">
    UDIString()
    <span class="tags">方法</span>
  </h4>
	<p>
	public string <strong>UDIString</strong>($udi)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$udi</td>
      <td class="param_type">array</td>
      <td class="param_desc">要处理的 UDI</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">string</td>
      <td class="param_desc"></td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>返回 UDI 的字符串表现形式</p>
  </div>
	<hr>
    
  <a name="QContext_normalizeUDI"></a>

  <h4 class="name method">
    normalizeUDI()
    <span class="tags">方法</span>
  </h4>
	<p>
	public array <strong>normalizeUDI</strong>($udi, $return_array)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$udi</td>
      <td class="param_type">string|array</td>
      <td class="param_desc">要处理的 UDI</td>
    </tr>
    
    <tr>
      <td class="param_name">$return_array</td>
      <td class="param_type">boolean</td>
      <td class="param_desc">是否返回数组形式的 UDI</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">array</td>
      <td class="param_desc">处理后的 UDI</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>返回规范化以后的 UDI 数组</p>

<pre class="php code"><span class="re0">$udi</span> <span
class="sy0">=</span> <span class="kw3">array</span><span
class="br0">&#40;</span>
    QContext<span class="sy0">::</span><span
class="me2">UDI_CONTROLLER</span> <span class="sy0">=&gt;</span> <span
class="st_h">''</span><span class="sy0">,</span>
    QContext<span
class="sy0">::</span><span class="me2">UDI_ACTION</span>     <span
class="sy0">=&gt;</span> <span class="st_h">''</span><span
class="sy0">,</span>
    QContext<span class="sy0">::</span><span
class="me2">UDI_NAMESPACE</span>  <span class="sy0">=&gt;</span> <span
class="st_h">''</span><span class="sy0">,</span>
    QContext<span
class="sy0">::</span><span class="me2">UDI_MODULE</span>     <span
class="sy0">=&gt;</span> <span class="st_h">''</span><span
class="sy0">,</span>
<span class="br0">&#41;</span><span
class="sy0">;</span>
&nbsp;
<span class="co1">// 输出</span>
<span
class="co1">// array(</span>
<span
class="co1">//     controller: default</span>
<span
class="co1">//     action:     index</span>
<span
class="co1">//     namespace:  default</span>
<span
class="co1">//     module:     default</span>
<span
class="co1">// )</span>
dump<span class="br0">&#40;</span><span
class="re0">$context</span><span class="sy0">-&gt;</span><span
class="me1">normalizeUDI</span><span class="br0">&#40;</span><span
class="re0">$udi</span><span class="br0">&#41;</span><span
class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span
class="re0">$udi</span> <span class="sy0">=</span> <span
class="st_h">'admin::posts/edit'</span><span class="sy0">;</span>
<span
class="co1">// 输出</span>
<span class="co1">// array(</span>
<span
class="co1">//     controller: posts</span>
<span
class="co1">//     action:     edit</span>
<span
class="co1">//     namespace:  admin</span>
<span
class="co1">//     module:     default</span>
<span
class="co1">// )</span>
dump<span class="br0">&#40;</span><span
class="re0">$context</span><span class="sy0">-&gt;</span><span
class="me1">normalizeUDI</span><span class="br0">&#40;</span><span
class="re0">$udi</span><span class="br0">&#41;</span><span
class="br0">&#41;</span><span class="sy0">;</span></pre>

<p>如果要返回字符串形式的 UDI，设置 $return_array 参数为
false。</p>
  </div>
	<hr>
    
  <a name="QContext_requestUDI"></a>

  <h4 class="name method">
    requestUDI()
    <span class="tags">方法</span>
  </h4>
	<p>
	public string|array <strong>requestUDI</strong>($return_array)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$return_array</td>
      <td class="param_type">boolean</td>
      <td class="param_desc">是否返回数组形式的 UDI</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">string|array</td>
      <td class="param_desc">对应当前请求的 UDI</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>返回当前请求对应的 UDI</p>

<p>将当前请求中包含的控制器、动作、名字空间和模块名提取出来，构造为一个
UDI。</p>

<pre class="php code">dump<span class="br0">&#40;</span><span
class="re0">$context</span><span class="sy0">-&gt;</span><span
class="me1">requestUDI</span><span class="br0">&#40;</span><span
class="br0">&#41;</span><span class="br0">&#41;</span><span
class="sy0">;</span></pre>
  </div>
	<hr>
    
  <a name="QContext_changeRequestUDI"></a>

  <h4 class="name method">
    changeRequestUDI()
    <span class="tags">方法</span>
  </h4>
	<p>
	public QContext <strong>changeRequestUDI</strong>($udi)	</p>
  <table class="list-table table table-bordered">

        
    <tr>
      <td class="param_name">$udi</td>
      <td class="param_type">array|string</td>
      <td class="param_desc">要设置的 UDI</td>
    </tr>
    
    <tr>
      <td class="param_name">{return}</td>
      <td class="param_type">QContext</td>
      <td class="param_desc">返回 QContext 对象本身，实现连贯接口</td>
    </tr>
    
  </table>

  <div class="formatted">
    
<p>将 QContext 对象保存的请求参数设置为 UDI 指定的值</p>

<pre class="php code"><span class="re0">$context</span><span
class="sy0">-&gt;</span><span class="me1">changeRequestUDI</span><span
class="br0">&#40;</span><span class="st_h">'posts/edit'</span><span
class="br0">&#41;</span><span class="sy0">;</span>
<span
class="co1">// 将输出 posts</span>
<span class="kw3">echo</span> <span
class="re0">$context</span><span class="sy0">-&gt;</span><span
class="me1">controller_name</span><span class="sy0">;</span></pre>
  </div>
	<hr>
  
</div>


</div>


    </div>

    <!-- /右侧栏 -->
    </div>
	</div>
</body>
</html>
